package com.zb.vo;

import com.zb.annotation.NumberPattern;
import com.zb.entity.FieldValOptionVo;
import com.zb.entity.FieldVo;
import com.zb.utils.VerificUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @Author WEN
 * @Date 2023/8/18 0018
 **/
@Data
@ApiModel("商品字段值对象")
public class GoodsFieldValVo {
    @ApiModelProperty(value = "商品字段值ID，新增不必传，修改必传")
    private Long id;

    @NotNull(message = "商品参数字段ID不能为空")
    @ApiModelProperty(value = "商品参数字段ID", required = true)
    private Long goodsParamFieldId;

    @NumberPattern(regexp = VerificUtil.FIELD_TYPE, message = "商品字段类型不合法！")
    @ApiModelProperty(value = "字段类型：1-文本，2-多行文本，3-单选，4-多选，5-多图，6-附件，7-视频，8-评分")
    private Integer type;

    @Length(max = 20, message = "字段名称限制20个字符以内")
    @ApiModelProperty(value = "字段名称")
    private String name;

    @Valid
    @ApiModelProperty(value = "字段选项的值")
    private List<FieldValOptionVo> optVos;
}
